package com.lynn.baseproject

import androidx.test.core.app.ActivityScenario
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import org.junit.Rule
import org.junit.Test
import org.junit.runner.RunWith

/**
 * @description:
 * @author: bailing
 * @datetime: 2025/5/30 06:14
 **/
@RunWith(AndroidJUnit4::class)
class MainActivityTest {
    @Rule
    @JvmField
    val rule = ActivityScenarioRule(MainActivity::class.java)

    @Test
    fun testDialogDisplay() {
        val scenario = ActivityScenario.launch<MainActivity>(MainActivity::class.java)
        scenario.onActivity {
           // 调用对话框显示方法
            it.testDialog2()
        }
        onView(withId(com.lynn.common.dialog.R.id.tv_sure)).check(matches(isDisplayed()))
    }
}